package com.example.film.controller;

import com.example.film.entity.NewCinema;
import com.example.film.service.NewCinemaService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@Api(tags = "新增影院信息管理接口")
@CrossOrigin
@RestController
@RequestMapping("newCinema/v1")
public class NewCinemaController {
    @Autowired
    private NewCinemaService newCinemaService;

    @ApiOperation("新增影院信息")
    @GetMapping("/newInfo")
    public List<NewCinema> getNewCinema(){
        return newCinemaService.findNewCinema();
    }

    @ApiOperation("分页查询新增影院信息")
    @GetMapping("/cinemaInfo")
    public List<NewCinema> getNewCinemaInfo(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return newCinemaService.findNewCinemaInfo(pageNum, pageSize);
    }

    @ApiOperation("根据年份和月份分页显示新增影院信息")
    @GetMapping("/date")
    public List<NewCinema> getNewCinemaByDate(@RequestParam(defaultValue = "2023") Integer year,@RequestParam Integer month,@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10") Integer pageSize){
        return newCinemaService.findNewCinemaByDate(year, month, pageNum, pageSize);
    }
}
